-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy navigation area infrastructure from Gutenberg #1865
Conversation
@anton-vlasenko @adamziel @talldan: I'm not 100% sure how to test this. Could you please give it a whirl? |
Need to add this new addition from diff --git a/lib/navigation.php b/lib/navigation.php
index 8a3587ae7d..5f69152724 100644
--- a/lib/navigation.php
+++ b/lib/navigation.php
@@ -56,6 +56,14 @@ function gutenberg_register_navigation_post_type() {
}
add_action( 'init', 'gutenberg_register_navigation_post_type' );
+/**
+ * Disable "Post Attributes" for wp_navigation post type.
+ *
+ * The attributes are also conditionally enabled when a site has custom templates.
+ * Block Theme templates can be available for every post type.
+ */
+add_filter( 'theme_wp_navigation_templates', '__return_empty_array' );
+ |
9de3725
to
c65a43e
Compare
return; | ||
} | ||
|
||
add_post_type_support( $post_type, 'editor' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we doing this? Are not just not register support for editor, until we are ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We temporarily disable it in _disable_content_editor_for_navigation_post_type
so that the editor doesn't appear when you edit the CPT. This re-enables it.
'post_content' => serialize_blocks( $parsed_blocks ), | ||
'post_status' => $post_status, | ||
); | ||
$navigation_post_id = wp_insert_post( $post_data ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There NEEDs to be some error handling here. What is the database falls over and this returns a WP_Error
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning error here and then Error 500 from the API endpoint sounds like a sensible thing to do
Unit tests seem to be failing... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test
c65a43e
to
07379cf
Compare
We will have to rename |
Copies navigation area infrastructure from
lib/navigation.php
in Gutenberg to Core.I meant to include this #1804 but I ran out of time on Tuesday 🙂
Trac ticket: https://core.trac.wordpress.org/ticket/54337
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.